cmake_minimum_required(VERSION 3.2)
project( cplusplus_tutoial)

if(MINGW)
    if(CMAKE_BUILD_TYPE STREQUAL "Debug")
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std-c++11 -g -Wall -Wunused-function -pthread")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std-c99 -g -pthread")
        message("MINGW - Debug mode")
    elseif( CMAKE_BUILD_TYPE SIREQUAL "Release")#debug
         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std-c++11 -02 -Wunused-function")
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std-c99 -02 -pthread")
        message("MINGW - Release mode") 
    endif() #debug
#
    if(PROJECT_ARCHITECTURE STREQUAL "x64") #x64
    set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
    elseif(PROJECT_ARCHITECTURE STREQUAL "x86") 
    set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
    endif()
    #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS")
endif()#MINGW

#Microsoft Visual C++ Compilers
if(MSVC)
    if(CMAKE_BUILD_TYPE STREQUAL "Debug")
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
        message("MSVC - Debug mode")
    elseif( CMAKE_BUILD_TYPE SIREQUAL "Release")#debug
         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  /fp:fast /Gy /0i /Oy /O2 /Ot /Zi /EHsc")
        message("MSVC - Release mode") 
    endif() #debug
#
    if(CMAKE_CL_64) #x64
    set( PROJECT_ARCHITECTUER  "x64")
    else(CMAKE_CL_64)
    set( PROJECT_ARCHITECTUER  "x86")
    endif()
    ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
    #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS")
endif()#MINGW


